<template>
	<div>
		<el-tabs v-model="activeName">
			<el-tab-pane label="网站基本信息" name="1"></el-tab-pane>
			<el-tab-pane label="系统配置" name="5"></el-tab-pane>
			<el-tab-pane label="默认图设置" name="7"></el-tab-pane>
			<!-- <el-tab-pane label="信箱配置" name="10"></el-tab-pane> -->
			<!-- <el-tab-pane label="水印设置" name="8"></el-tab-pane> -->
		</el-tabs>
		<div v-if="activeName == 1">
			<List :flag="flag" :type="1" />
			<Add :flag="flag" :type="1" />
		</div>
		<div v-if="activeName == 5"><BasicConfig /></div>
		<div v-if="activeName == 7">
			<List :flag="flag" :type="2" />
			<Add :flag="flag" :type="2" />
		</div>
		<div v-if="activeName == 8"><WatermarkSettings /></div>
		<div v-if="activeName == 10">
			<mailbox-config></mailbox-config>
		</div>
	</div>
</template>
<script>
export default {
	components: {
		List: () => import('./List.vue'),
		Add: () => import('./Add.vue'),
		BasicConfig: () => import('../config/basicConfig.vue'),
		WatermarkSettings: () => import('./WatermarkSetting.vue'),
		mailboxConfig: () => import('./mailboxConfig')
	},
	data() {
		return {
			flag: false, //开发者权限
			activeName: '1',
			routeName: ''
		};
	},
	watch: {
		$route(v) {
			this.activeName = '1';
			this.routeName = v.name;
		}
	},
	mounted() {
		this.routeName = this.$route.name;
		this.getDeverMode();
	},
	methods: {
		//是否开发者模式
		async getDeverMode() {
			let userId = this.$store.state.userInfo.userInfo.id;
			if (userId != 1) return;
			let res = await this.$store.dispatch('getDictionaryVal', 'DEVER');
			this.flag = res[0] == 1;
		}
	}
};
</script>
